package cn.ihuizi.action;

import java.io.IOException;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.Vector;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cn.ihuizi.dao.AdminDao;
import cn.ihuizi.dao.impl.AdminDaoImpl;
import cn.ihuizi.entity.Admin;
import cn.ihuizi.service.AdminService;
import cn.ihuizi.service.impl.AdminServiceImpl;

/**
 * Servlet implementation class AdminSelectAllServlet
 */
@WebServlet("/AdminSelectAllServlet")
public class AdminSelectAllServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		/*response.getWriter().append("Served at: ").append(request.getContextPath());*/
		request.setCharacterEncoding("UTF-8");
		response.setCharacterEncoding("utf-8");
		response.setContentType("text/html;charset=UTF-8");
		AdminService adminService = new AdminServiceImpl();
		List list = new ArrayList();
		list = adminService.selectAdminAll();
		//角色
		
		
		request.setAttribute("list", list);//不包括角色的集合
		request.getRequestDispatcher("view/admin/admin_list.jsp").forward(request, response);
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}
